package com.asman.worker.rn

import com.asman.worker.splash.SplashScreen
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod
import java.util.*
import com.asman.worker.splash.SplashScreen.hide



/**
 * author : ybk
 * date   : 2019-07-18 19:47
 * desc   :
 */
class NativeSplashScreen(reactContext: ReactApplicationContext) :
    ReactContextBaseJavaModule(reactContext) {

    override fun getName(): String {
        return "NativeSplashScreen"
    }

    override fun getConstants(): Map<String, Any>? {
        val constants = HashMap<String, Any>()
        return constants
    }

//    @ReactMethod
//    fun hide() {
//        log("----->$currentActivity")
//        currentActivity?.finish()
//    }

    /**
     * 打开启动屏
     */
    @ReactMethod
    fun show() {
        SplashScreen.show(currentActivity)
    }

    /**
     * 关闭启动屏
     */
    @ReactMethod
    fun hide() {
        hide(currentActivity)
    }
}
